package com.qianbei.user.unlogin;

import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Handler;
import android.os.Message;

import com.qianbei.R;
import com.qianbei.common.base.ActivityManagers;
import com.qianbei.common.net.control.unlogin.UnloginInterface;
import com.qianbei.common.net.view.MsgAlert;
import com.qianbei.common.web.WebActivity;
import com.qianbei.view.LoginActivity;

import org.json.JSONObject;

public class Unlogin implements UnloginInterface {

    @Override
    public void unloginlistener() {
        UserLoginOut.getInstance().CleanData();

        ActivityManagers
                .getInstance()
                .getCurrentActivity()
                .startActivity(
                        new Intent(ActivityManagers.getInstance()
                                .getCurrentActivity(),
                                LoginActivity.class));


        handler.sendEmptyMessage(0);

        String curentClass = ActivityManagers.getInstance()
                .getCurrentActivity().getClass().toString();

    }

    @Override
    public void showDialog(JSONObject jsonObject) {
        String msg = jsonObject.optString("msg");
        final String url = jsonObject.optString("url");

    }


    Handler handler = new Handler() {
        boolean isShowNetBreak = true;

        @Override
        public void dispatchMessage(Message msg) {
            super.dispatchMessage(msg);
            switch (msg.what) {
                case 0:
                    if (isShowNetBreak) {
                        //new MsgAlert().show("您的账号在别的设备登录");
                        isShowNetBreak = false;
                    }
                    break;

            }


        }
    };

}
